// stores/counter.js
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', {
  state: () => {
    return { 
      isLogin: false,
      username: '',
      role_id: '',
      user_id:''
    }
  },
  // 也可以这样定义
  // state: () => ({ count: 0 })
  actions: {
    login() {
      this.isLogin = true
    },
    logout() {
      this.isLogin = false
    },
    set_userName(username) {
      this.username = username
    },
    get_role(role_id) {
      this.role_id = role_id
    },
    get_userId(user_id) {
      this.user_id = user_id
    }
  },
})